package com.acme.bankapp.domain.bank;

import java.io.Serializable;

public class SavingAccount extends AbstractAccount implements Serializable {
	private long longBalance;
	
	public SavingAccount(double amount) {
		super(amount);
		longBalance=Math.round(amount);
	}
	
	public long getLongBalance() {
		return longBalance;
	}

	public void setLongBalance(long longBalance) {
		this.longBalance = longBalance;
	}

	public SavingAccount() {
		super();
	}
	
	@Override
	public double maximumAmountToWithdraw() {
		return this.balance;
	}
	
	@Override
	public void withdraw(double amount) {
		if (this.balance > amount) {
			this.balance=this.balance-amount;
			System.out.println(" succsessful. Your balance now: "+balance);
		}
		else System.out.println(" not succsessful (Not enough money on the account). Your balance: "+balance);
	}

	@Override
	public long decimalValue() {
		return Math.round(balance);
	}
}
